package com.fjw.service.impl;

import com.fjw.mapper.TeaMapper;
import com.fjw.pojo.Tea;
import com.fjw.service.TeaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeaServiceImpl implements TeaService {

    @Autowired
    private TeaMapper teaMapper;

    // 原有方法实现
    @Override
    public void add(Tea tea) {
        teaMapper.add(tea);
    }

    @Override
    public Tea findById(Integer id) {
        return teaMapper.findById(id);
    }

    @Override
    public List<Tea> getAll() {
        return teaMapper.getAll();
    }

    @Override
    public void deleteById(Integer id) {
        teaMapper.deleteById(id);
    }

    @Override
    public void updateById(Tea tea) {
        teaMapper.updateById(tea);
    }

    // 新增根据 name 模糊查询的实现，调用 Mapper 方法
    @Override
    public List<Tea> findByName(String name) {
        return teaMapper.findByName(name);
    }

    @Override
    public List<Tea> findByStatus(Integer status) {
        return teaMapper.findByStatus(status);
    }

    @Override
    public List<Tea> findByType(String type) {
        return teaMapper.findByType(type);
    }
}